<?php
/**
 * Created by PhpStorm.
 * User: sMile
 * Date: 16/5/14
 * Time: 上午8:02
 */

require_once('connect.php');

//if(!$userName = $_POST['userName']){
    $userName = $_GET['userName'];
//}
//if(!$password = $_POST['password']){
    $password = $_GET['password'];
//}

//if($userName && $password){
    if($result = mysqli_fetch_row(mysqli_query($link,"select * from user where name='$userName'"))){
        //print_r($result);
        echo '用户已存在';
    }else{

        if($count = mysqli_query($link," insert into user (name, password) VALUE ('$userName', '$password')")){
            echo '0';
        }else
            echo 'failed';
    }

//}

